
<template>
    <!-- 客户管理 -->
    <div>
        <el-form :inline="true" class="demo-form-inline">
            <el-form-item label="客户名称">
                <el-input v-model="Msearch.name" placeholder="客户名称"></el-input>
            </el-form-item>
            <el-form-item label="目的学校">
                <el-input v-model="Msearch.school" placeholder="目的学校"></el-input>
            </el-form-item>
            <el-form-item label="推荐套餐">
                <el-input v-model="Msearch.produce" placeholder="推荐套餐"></el-input>
            </el-form-item>
            <el-form-item label="所属渠道">
                <el-input v-model="Msearch.orgnization" placeholder="所属渠道"></el-input>
            </el-form-item>
            <el-form-item label="时间区间">
                <el-date-picker v-model="Msearch.time" type="daterange" placeholder="选择日期范围">
                </el-date-picker>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
        </el-form>

        <el-card class="box-card">
            <div slot="header" class="clearfix">
                <span style="line-height: 36px;">客户列表</span>
                <el-button type="primary" style="float:right" @click="goAddCustom">新增</el-button>
            </div>
            <custom-list ref="customList" @goAddCommunication="goAddCommunication" @goCustomEditer="goCustomEditer"></custom-list>
        </el-card>
        <el-dialog title="沟通记录添加" :visible.sync="connectionAdd" v-if="connectionAdd">
            <communication-Add :id="id" :type="type" @close="close">
            </communication-Add>
        </el-dialog>
        <el-dialog title="新增客戶" :visible.sync="crmadd" v-if="crmadd" size="large">
            <custom-show :oid="oid" :type="'新增'" @close="close">
            </custom-show>
        </el-dialog>
          <el-dialog title="查看客戶信息" :visible.sync="customEditer" v-if="customEditer" size="large">
            <custom-show :oid="oid" :type="'修改'" :Id="customId" @close="close">
            </custom-show>
        </el-dialog>
    </div>
</template>
<script>
import CustomList from "@/components/Crm/CustomList";
import CommunicationAdd from "@/components/Crm/CommunicationAdd";
import CustomShow from "@/components/Crm/CustomShow";
export default {
  data() {
    return {
      daterange: "",
      connectionAdd: false, //渠道新增
      id: "", //沟通记录 客户、渠道id
      type: "", //沟通记录 类型

      crmadd: false,
      oid: "", // 渠道id
      customEditer: false,
      Msearch: {
        name: "",
        school: "",
        produce: "",
        orgnization: "",
        time: []
      },
      //修改用id
      customId: ""
    };
  },
  components: {
    "custom-list": CustomList,
    "communication-Add": CommunicationAdd,
    "custom-show": CustomShow
  },
  methods: {
    onSubmit: function() {
     this.$refs.customList.Mselect(this.Msearch);
    },
    AddOrganization: function() {},
    //关闭弹窗
    close() {
      this.crmadd = false;
      this.customEditer = false;
      this.connectionAdd = false;
      // this.organizaitionEditer=false;
      //更新list
      this.$refs.customList.Getdata();
    },
    //新增沟通记录
    goAddCommunication(data) {
      this.id = data.id;
      this.type = data.type;
      this.connectionAdd = true;
    },
    //新增客户信息
    goAddCustom(oid) {
   
      this.oid = oid;
      this.crmadd = true;
    },
    //查看 修改客户信息
    goCustomEditer(id) {
     
      this.customId = id;
      this.customEditer = true;
    }
  }
};
</script>

